package com.team2.outpatient_sys.dao;

import com.team2.outpatient_sys.pojo.ProvideMedicine;
import com.team2.outpatient_sys.pojo.QueueUp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface QueueUpDao {

    @Insert("insert into queue_up values(null,#{doctorId},#{patientId},#{queueNo},#{state})")
    public Integer add(QueueUp queueUp);

    @Select("select * from queue_up where state = 0")
    public List<QueueUp> searchQueueList();

    @Select("select * from queue_up where id = #{id}")
    public QueueUp findById(Long id);

    @Update("update queue_up set doctor_id = #{doctorId},patient_id=#{patientId},queue_no=#{queueNo},state=#{state} where id=#{id}")
    public Integer update(QueueUp queueUp);

    @Select("select * from queue_up where patient_id = #{patientId} and state = 2")
    public QueueUp findByPatientId(Long patientId);

    @Select("select * from queue_up where state = 2")
    public List<QueueUp> findByNoResponse();
}
